<<<<<<< HEAD
"""
另一个例子
"""

from scipy.optimize import linprog
import numpy as np

# 目标函数：max z = 2x1 + 3x2 - 5x3
fval = np.array([2, 3, -5])
# 不等约束（大于等于/大于的条件两边要加负号）
A = np.array([[-2, 5, -1], [1, 3, 1]])
b = np.array([-10, 12])
# 等式约束
A_eq = np.array([[1, 1, 1]])
b_eq = np.array([7])
# 决策变量的下界与上界
lb = 0
ub = None
# 求解线性规划
res = linprog(-fval, A_ub=A, b_ub=b, A_eq=A_eq, b_eq=b_eq,
              bounds=((lb, ub), (lb, ub), (lb, ub)))
# 输出
print(res)
=======
"""
另一个例子
"""

from scipy.optimize import linprog
import numpy as np

# 目标函数：max z = 2x1 + 3x2 - 5x3
fval = np.array([2, 3, -5])
# 不等约束（大于等于/大于的条件两边要加负号）
A = np.array([[-2, 5, -1], [1, 3, 1]])
b = np.array([-10, 12])
# 等式约束
A_eq = np.array([[1, 1, 1]])
b_eq = np.array([7])
# 决策变量的下界与上界
lb = 0
ub = None
# 求解线性规划
res = linprog(-fval, A_ub=A, b_ub=b, A_eq=A_eq, b_eq=b_eq,
              bounds=((lb, ub), (lb, ub), (lb, ub)))
# 输出
print(res)
>>>>>>> a66c8eec2c3bbe955d7da215f43ffffda9c7b6b5
